package com.mdsi.db;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

import oracle.jdbc.driver.OracleDriver;

public class ConnectionManager {
	
	private static final String DATABASE_URL = "jdbc:oracle:thin:@localhost:1521:XE" ;
	private static final String DATABASE_USER = "mdsi_user" ;
	private static final String DATABASE_PASS = "mdsi_pass" ;
	private static boolean REGISTER = false ;

	public static Connection getConnection () throws SQLException {
		if (!REGISTER) {
			DriverManager.registerDriver(new OracleDriver()) ;
			REGISTER = true ;
		}
		DriverManager.registerDriver(new OracleDriver()) ;
		Connection conn = DriverManager.getConnection(DATABASE_URL, DATABASE_USER, DATABASE_PASS) ;
		conn.setAutoCommit(false) ;
		return conn ;
	}
	
}
